import React, {Component, PropTypes} from  'react';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';

import {
	Row,
	Col
} from 'antd';

import reducer from './reducer';

// import Workspace from './workspace';
import SearchBar from './searchBar';
import Info from './info';
import Tools from './Components/Tools';
import Workpace from './Components/WorkSpace';
import './style.less';

class GraphApp extends Component {
	constructor(props) {
		super(props);
		this.store = createStore(reducer, applyMiddleware(thunk));
		this.state = {
			searchType: ''
		}
	}
	
	setSearchType = (searchType) => {
		this.setState({
			searchType
		})
	}
	getSearchType = () => {
		return this.state.searchType;
	}
	render() {
		return <Provider store={this.store}>
			<div className="graph-main">
				<Tools setSearchType={this.setSearchType}/>
				<Workpace getSearchType={this.getSearchType}/>
				{/*<SearchBar setSearchType={this.setSearchType}/>*/}
				<Info/>
			</div>	
		</Provider>;
	}
}

export default GraphApp;